/*
 * @Author: your name
 * @Date: 2021-11-19 20:36:12
 * @LastEditTime: 2021-12-03 17:14:23
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \jf-nlitc\vue.config.js
 */
const path = require("path");

const title = "项目选址";
module.exports = {
  publicPath: "./",
  outputDir: process.env.NODE_ENV === "development" ? "devdist" : "dist", // 不同的环境打不同包名
  // outputDir: 'dist',
  lintOnSave: false, // 关闭eslint
  productionSourceMap: true, // 生产环境下css 分离文件
  devServer: {
    // 配置服务器
    open: true,
    // 项目运行时候的端口号
    port: 3000,
    // https: false,
    disableHostCheck: true,

    overlay: {
      warnings: true,
      errors: true,
    },
    proxy: {
      "/api": {
        target: "http://120.77.174.86:8200/",
        changeOrigin: true,
        pathRewrite: {
          "^/api": "",
        },
      },
      "/WeatherId": {
        target: "https://geoapi.qweather.com/",
        changeOrigin: true,
        pathRewrite: {
          "^/WeatherId": "",
        },
      },
      "/WeatherData": {
        target: "https://devapi.qweather.com/",
        changeOrigin: true,
        pathRewrite: {
          "^/WeatherData": "",
        },
      },
      "/Sjsx": {
        // target: "http://19.103.11.93:8090/",   // 深汕的
        // target: "http://192.168.5.76:8090/",  // 公司的
        // target: "http://192.168.1.78:8090/",   // 生态园的地址
        target:"http://42.81.211.242:8990/", // 公司公网地址
        // target: "http://192.168.5.121:8090/",
        // target: "http://192.168.137.196:8090/",
        // target: "http://192.168.5.108:8090/", // 公司的2
        changeOrigin: true,
        pathRewrite: {
          "^/Sjsx": "",
        },
      },
      "/Geojson": {
        target: "http://42.81.211.242:8778/",
        changeOrigin: true,
        pathRewrite: {
          "^/Geojson": "",
        },
      },
    },
  },
  css: {
    sourceMap: true, // 开启 CSS source maps
    loaderOptions: {
      sass: {
        prependData: "@import '@/styles/common.scss';",
      },
    },
  },

  configureWebpack: {
    resolve: {
      // 配置解析别名
      alias: {
        "@": path.resolve(__dirname, "./src"),
        "@s": path.resolve(__dirname, "./src/assets/style"),
        "@i": path.resolve(__dirname, "./src/assets/images"),
      },
    },
  },
  chainWebpack: (config) => {
    config.plugin("html").tap((args) => {
      args[0].title = title;
      return args;
    });
  },
};
